import 'package:lz_base/kd_base.dart';

class KDMineCertificationInfoModel {
  // 受理日期
  String? acceptDate;
  // 受理人
  String? acceptName;
  // 受理人手机号
  String? acceptPhone;
  // 年龄
  // String? age;
  // 申请日期
  String? applyDate;
  // 申请人
  String? applyName;
  // 申请人手机号
  String? applyPhone;
  // 申请来源编码
  String? applySourceCode;
  // 申请来源名称
  String? applySourceName;
  // 审核状态，01：待审核，02：已临期，03：已过期，04：已退回，05：已审核通过
  String? authStatus;
  // 审核状态，01：待审核，02：已临期，03：已过期，04：已退回，05：已审核通过
  String? authStatusStr;
  // 认证类型，01：实名认证，02：身份证照片认证，03：驾驶证认证，04：从业资格证，05：企业资质认证，06：法人实名认证，07：法人身份证照片认证
  String? authType;
  // 认证类型，01：实名认证，02：身份证照片认证，03：驾驶证认证，04：从业资格证，05：企业资质认证，06：法人实名认证，07：法人身份证照片认证
  String? authTypeStr;
  // 出生日期
  String? birthDate;
  // 经营范围
  String? businessScope;
  // 证件反面图片url
  String? certificateBackUrl;
  // 证件反面图片url（长链接）
  String? certificateBackUrlLong;
  // 证件到期日期
  String? certificateEndDate;
  // 证件正面图片url
  String? certificateFrontUrl;
  // 证件正面图片url（长链接）
  String? certificateFrontUrlLong;
  // 证件号码
  String? certificateNumber;
  // 证件发证日期
  String? certificateStartDate;
  // 姓名/法人
  String? certificateUserName;
  // 企业名称
  String? companyName;
  // 创建时间
  String? createTime;
  // 创建人姓名
  String? createUserName;
  // 创建人
  String? createUserNo;
  // 准驾车型，01：A1，02：A2，03：A3，04：B1，05：B2，06：C1，07：C2
  String? driverLicenseType;
  // 准驾车型，01：A1，02：A2，03：A3，04：B1，05：B2，06：C1，07：C2
  String? driverLicenseTypeStr;
  // 是否已删除
  bool? enable;
  // 证件是否长期，1：是，0：否
  String? isEverEnable;
  // 发证机关
  String? licenseIssuingAuthority;
  // 主键ID
  String? memberAuthId;
  // 会员主键ID
  // int? memberId;
  // 根据身份证计算后年龄
  String? newAge;
  // 备注
  String? remark;
  // 住所
  String? residence;
  // 退回原因，01：照片不清晰，02：上传数据有误
  String? returnReason;
  // 退回原因，01：照片不清晰，02：上传数据有误
  String? returnReasonStr;
  // 性别，1：男，2：女
  String? sex;

  // 用户主键ID
  // int? userId;

  /// 添加两个实名认证属性
  String? realAuthStatus;
  String? farenRealAuthStatus;

  KDMineCertificationInfoModel({
    this.acceptDate,
    this.acceptName,
    this.acceptPhone,
    // this.age,
    this.applyDate,
    this.applyName,
    this.applyPhone,
    this.applySourceCode,
    this.applySourceName,
    this.authStatus,
    this.authStatusStr,
    this.authType,
    this.authTypeStr,
    this.birthDate,
    this.businessScope,
    this.certificateBackUrl,
    this.certificateBackUrlLong,
    this.certificateEndDate,
    this.certificateFrontUrl,
    this.certificateFrontUrlLong,
    this.certificateNumber,
    this.certificateStartDate,
    this.certificateUserName,
    this.companyName,
    this.createTime,
    this.createUserName,
    this.createUserNo,
    this.driverLicenseType,
    this.driverLicenseTypeStr,
    this.enable,
    this.isEverEnable,
    this.licenseIssuingAuthority,
    this.memberAuthId,
    // this.memberId,
    this.newAge,
    this.remark,
    this.residence,
    this.returnReason,
    this.returnReasonStr,
    this.sex,
    // this.userId,
  });

  factory KDMineCertificationInfoModel.fromJson(Map<String, dynamic> json) =>
      KDMineCertificationInfoModel(
        acceptDate: json["acceptDate"],
        acceptName: json["acceptName"],
        acceptPhone: json["acceptPhone"],
        // age: json["age"],
        applyDate: json["applyDate"],
        applyName: json["applyName"],
        applyPhone: json["applyPhone"],
        applySourceCode: json["applySourceCode"],
        applySourceName: json["applySourceName"],
        authStatus: json["authStatus"],
        authStatusStr: json["authStatusStr"],
        authType: json["authType"],
        authTypeStr: json["authTypeStr"],
        birthDate: json["birthDate"],
        businessScope: json["businessScope"],
        certificateBackUrl: json["certificateBackUrl"],
        certificateBackUrlLong: json["certificateBackUrlLong"],
        certificateEndDate: json["certificateEndDate"],
        certificateFrontUrl: json["certificateFrontUrl"],
        certificateFrontUrlLong: json["certificateFrontUrlLong"],
        certificateNumber: json["certificateNumber"],
        certificateStartDate: json["certificateStartDate"],
        certificateUserName: json["certificateUserName"],
        companyName: json["companyName"],
        createTime: json["createTime"],
        createUserName: json["createUserName"],
        createUserNo: json["createUserNo"],
        driverLicenseType: json["driverLicenseType"],
        driverLicenseTypeStr: json["driverLicenseTypeStr"],
        enable: json["enable"],
        isEverEnable: json["isEverEnable"],
        licenseIssuingAuthority: json["licenseIssuingAuthority"],
        memberAuthId: json["memberAuthId"],
        // memberId: json["memberId"],
        newAge: json["newAge"],
        remark: json["remark"],
        residence: json["residence"],
        returnReason: json["returnReason"],
        returnReasonStr: json["returnReasonStr"],
        sex: json["sex"],

        // userId: json["userId"],
      );

  Map<String, dynamic> toJson() => {
        "acceptDate": acceptDate,
        "acceptName": acceptName,
        "acceptPhone": acceptPhone,
        // "age": age,
        "applyDate": applyDate,
        "applyName": applyName,
        "applyPhone": applyPhone,
        "applySourceCode": applySourceCode,
        "applySourceName": applySourceName,
        "authStatus": authStatus,
        "authStatusStr": authStatusStr,
        "authType": authType,
        "authTypeStr": authTypeStr,
        "birthDate": birthDate,
        "businessScope": businessScope,
        "certificateBackUrl": certificateBackUrl,
        "certificateBackUrlLong": certificateBackUrlLong,
        "certificateEndDate": certificateEndDate,
        "certificateFrontUrl": certificateFrontUrl,
        "certificateFrontUrlLong": certificateFrontUrlLong,
        "certificateNumber": certificateNumber,
        "certificateStartDate": certificateStartDate,
        "certificateUserName": certificateUserName,
        "companyName": companyName,
        "createTime": createTime,
        "createUserName": createUserName,
        "createUserNo": createUserNo,
        "driverLicenseType": driverLicenseType,
        "driverLicenseTypeStr": driverLicenseTypeStr,
        "enable": enable,
        "isEverEnable": isEverEnable,
        "licenseIssuingAuthority": licenseIssuingAuthority,
        "memberAuthId": memberAuthId,
        // "memberId": memberId,
        "newAge": newAge,
        "remark": remark,
        "residence": residence,
        "returnReason": returnReason,
        "returnReasonStr": returnReasonStr,
        "sex": sex,

        // "userId": userId,
      };

  KDCertificationStateType get stateType =>
      KDCertificationStateType.from(int.parse(authStatus ?? "0"));
  KDCertificationType? get getAuthType => KDCertificationType.from(authType);
}
